<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>numberformat_test.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="local_closure_goog_i18n_numberformat_test.js.html">numberformat_test.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2006 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>goog.provide(&#39;goog.i18n.NumberFormatTest&#39;);
<a name="line16"></a>goog.setTestOnly(&#39;goog.i18n.NumberFormatTest&#39;);
<a name="line17"></a>
<a name="line18"></a>goog.require(&#39;goog.i18n.CompactNumberFormatSymbols&#39;);
<a name="line19"></a>goog.require(&#39;goog.i18n.CompactNumberFormatSymbols_de&#39;);
<a name="line20"></a>goog.require(&#39;goog.i18n.CompactNumberFormatSymbols_en&#39;);
<a name="line21"></a>goog.require(&#39;goog.i18n.CompactNumberFormatSymbols_fr&#39;);
<a name="line22"></a>goog.require(&#39;goog.i18n.NumberFormat&#39;);
<a name="line23"></a>goog.require(&#39;goog.i18n.NumberFormatSymbols&#39;);
<a name="line24"></a>goog.require(&#39;goog.i18n.NumberFormatSymbols_de&#39;);
<a name="line25"></a>goog.require(&#39;goog.i18n.NumberFormatSymbols_en&#39;);
<a name="line26"></a>goog.require(&#39;goog.i18n.NumberFormatSymbols_fr&#39;);
<a name="line27"></a>goog.require(&#39;goog.i18n.NumberFormatSymbols_pl&#39;);
<a name="line28"></a>goog.require(&#39;goog.i18n.NumberFormatSymbols_ro&#39;);
<a name="line29"></a>goog.require(&#39;goog.testing.ExpectedFailures&#39;);
<a name="line30"></a>goog.require(&#39;goog.testing.PropertyReplacer&#39;);
<a name="line31"></a>goog.require(&#39;goog.testing.jsunit&#39;);
<a name="line32"></a>goog.require(&#39;goog.userAgent&#39;);
<a name="line33"></a>goog.require(&#39;goog.userAgent.product&#39;);
<a name="line34"></a>goog.require(&#39;goog.userAgent.product.isVersion&#39;);
<a name="line35"></a>
<a name="line36"></a>var expectedFailures;
<a name="line37"></a>
<a name="line38"></a>var stubs = new goog.testing.PropertyReplacer();
<a name="line39"></a>
<a name="line40"></a>function setUpPage() {
<a name="line41"></a>  expectedFailures = new goog.testing.ExpectedFailures();
<a name="line42"></a>}
<a name="line43"></a>
<a name="line44"></a>function setUp() {
<a name="line45"></a>  // Always switch back to English on startup.
<a name="line46"></a>  goog.i18n.NumberFormatSymbols = goog.i18n.NumberFormatSymbols_en;
<a name="line47"></a>  goog.i18n.CompactNumberFormatSymbols =
<a name="line48"></a>      goog.i18n.CompactNumberFormatSymbols_en;
<a name="line49"></a>}
<a name="line50"></a>
<a name="line51"></a>function tearDown() {
<a name="line52"></a>  expectedFailures.handleTearDown();
<a name="line53"></a>  stubs.reset();
<a name="line54"></a>}
<a name="line55"></a>
<a name="line56"></a>function veryBigNumberCompare(str1, str2) {
<a name="line57"></a>  return str1.length == str2.length &amp;&amp;
<a name="line58"></a>         str1.substring(0, 8) == str2.substring(0, 8);
<a name="line59"></a>}
<a name="line60"></a>
<a name="line61"></a>function testVeryBigNumber() {
<a name="line62"></a>  var str;
<a name="line63"></a>  var fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.CURRENCY);
<a name="line64"></a>  str = fmt.format(1785599999999999888888888888888);
<a name="line65"></a>  // when comparing big number, various platform have small different in
<a name="line66"></a>  // precision. We have to tolerate that using veryBigNumberCompare.
<a name="line67"></a>  var expected = &#39;$1,785,599,999,999,999,400,000,000,000,000.00&#39;;
<a name="line68"></a>  assertTrue(veryBigNumberCompare(
<a name="line69"></a>      &#39;$1,785,599,999,999,999,400,000,000,000,000.00&#39;, str));
<a name="line70"></a>  str = fmt.format(1.7856E30);
<a name="line71"></a>  assertTrue(veryBigNumberCompare(
<a name="line72"></a>      &#39;$1,785,599,999,999,999,400,000,000,000,000.00&#39;, str));
<a name="line73"></a>  str = fmt.format(1.3456E20);
<a name="line74"></a>  assertTrue(veryBigNumberCompare(&#39;$134,560,000,000,000,000,000.00&#39;, str));
<a name="line75"></a>
<a name="line76"></a>  fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.DECIMAL);
<a name="line77"></a>  str = fmt.format(1.3456E20);
<a name="line78"></a>  assertTrue(veryBigNumberCompare(&#39;134,559,999,999,999,980,000&#39;, str));
<a name="line79"></a>
<a name="line80"></a>
<a name="line81"></a>  fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.PERCENT);
<a name="line82"></a>  str = fmt.format(1.3456E20);
<a name="line83"></a>  assertTrue(veryBigNumberCompare(&#39;13,456,000,000,000,000,000,000%&#39;, str));
<a name="line84"></a>
<a name="line85"></a>  fmt = new goog.i18n.NumberFormat(
<a name="line86"></a>      goog.i18n.NumberFormat.Format.SCIENTIFIC);
<a name="line87"></a>  str = fmt.format(1.3456E20);
<a name="line88"></a>  assertEquals(&#39;1E20&#39;, str);
<a name="line89"></a>
<a name="line90"></a>  fmt = new goog.i18n.NumberFormat(
<a name="line91"></a>      goog.i18n.NumberFormat.Format.DECIMAL);
<a name="line92"></a>  str = fmt.format(-1.234567890123456e306);
<a name="line93"></a>  assertEquals(1 + 1 + 306 + 306 / 3, str.length);
<a name="line94"></a>  assertEquals(&#39;-1,234,567,890,123,45&#39;, str.substr(0, 21));
<a name="line95"></a>
<a name="line96"></a>  str = fmt.format(Infinity);
<a name="line97"></a>  assertEquals(&#39;\u221e&#39;, str);
<a name="line98"></a>  str = fmt.format(-Infinity);
<a name="line99"></a>  assertEquals(&#39;-\u221e&#39;, str);
<a name="line100"></a>}
<a name="line101"></a>
<a name="line102"></a>function testStandardFormat() {
<a name="line103"></a>  var str;
<a name="line104"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line105"></a>      goog.i18n.NumberFormat.Format.CURRENCY);
<a name="line106"></a>  str = fmt.format(1234.579);
<a name="line107"></a>  assertEquals(&#39;$1,234.58&#39;, str);
<a name="line108"></a>  fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.DECIMAL);
<a name="line109"></a>  str = fmt.format(1234.579);
<a name="line110"></a>  assertEquals(&#39;1,234.579&#39;, str);
<a name="line111"></a>  fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.PERCENT);
<a name="line112"></a>  str = fmt.format(1234.579);
<a name="line113"></a>  assertEquals(&#39;123,458%&#39;, str);
<a name="line114"></a>  fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.SCIENTIFIC);
<a name="line115"></a>  str = fmt.format(1234.579);
<a name="line116"></a>  assertEquals(&#39;1E3&#39;, str);
<a name="line117"></a>  // Math.log(1000000)/Math.LN10 is strictly less than 6. Make sure it gets
<a name="line118"></a>  // formatted correctly.
<a name="line119"></a>  str = fmt.format(1000000);
<a name="line120"></a>  assertEquals(&#39;1E6&#39;, str);
<a name="line121"></a>}
<a name="line122"></a>
<a name="line123"></a>function testNegativePercentage() {
<a name="line124"></a>  var str;
<a name="line125"></a>  var fmt = new goog.i18n.NumberFormat(&#39;#,##0.00%&#39;);
<a name="line126"></a>  str = fmt.format(-1234.56);
<a name="line127"></a>  assertEquals(&#39;-123,456.00%&#39;, str);
<a name="line128"></a>
<a name="line129"></a>  fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.PERCENT);
<a name="line130"></a>  str = fmt.format(-1234.579);
<a name="line131"></a>  assertEquals(&#39;-123,458%&#39;, str);
<a name="line132"></a>}
<a name="line133"></a>
<a name="line134"></a>function testCustomPercentage() {
<a name="line135"></a>  var fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.PERCENT);
<a name="line136"></a>  fmt.setMaximumFractionDigits(1);
<a name="line137"></a>  fmt.setMinimumFractionDigits(1);
<a name="line138"></a>  var str = fmt.format(0.1291);
<a name="line139"></a>  assertEquals(&#39;12.9%&#39;, str);
<a name="line140"></a>  fmt.setMaximumFractionDigits(2);
<a name="line141"></a>  fmt.setMinimumFractionDigits(1);
<a name="line142"></a>  str = fmt.format(0.129);
<a name="line143"></a>  assertEquals(&#39;12.9%&#39;, str);
<a name="line144"></a>  fmt.setMaximumFractionDigits(2);
<a name="line145"></a>  fmt.setMinimumFractionDigits(1);
<a name="line146"></a>  str = fmt.format(0.12);
<a name="line147"></a>  assertEquals(&#39;12.0%&#39;, str);
<a name="line148"></a>  fmt.setMaximumFractionDigits(2);
<a name="line149"></a>  fmt.setMinimumFractionDigits(1);
<a name="line150"></a>  str = fmt.format(0.12911);
<a name="line151"></a>  assertEquals(&#39;12.91%&#39;, str);
<a name="line152"></a>}
<a name="line153"></a>
<a name="line154"></a>function testBasicParse() {
<a name="line155"></a>  var value;
<a name="line156"></a>
<a name="line157"></a>  var fmt = new goog.i18n.NumberFormat(&#39;0.0000&#39;);
<a name="line158"></a>  value = fmt.parse(&#39;123.4579&#39;);
<a name="line159"></a>  assertEquals(123.4579, value);
<a name="line160"></a>
<a name="line161"></a>  value = fmt.parse(&#39;+123.4579&#39;);
<a name="line162"></a>  assertEquals(123.4579, value);
<a name="line163"></a>
<a name="line164"></a>  value = fmt.parse(&#39;-123.4579&#39;);
<a name="line165"></a>  assertEquals(-123.4579, value);
<a name="line166"></a>}
<a name="line167"></a>
<a name="line168"></a>function testPrefixParse() {
<a name="line169"></a>  var value;
<a name="line170"></a>
<a name="line171"></a>  var fmt = new goog.i18n.NumberFormat(&#39;0.0;(0.0)&#39;);
<a name="line172"></a>  value = fmt.parse(&#39;123.4579&#39;);
<a name="line173"></a>  assertEquals(123.4579, value);
<a name="line174"></a>
<a name="line175"></a>  value = fmt.parse(&#39;(123.4579)&#39;);
<a name="line176"></a>  assertEquals(-123.4579, value);
<a name="line177"></a>}
<a name="line178"></a>
<a name="line179"></a>function testPrecentParse() {
<a name="line180"></a>  var value;
<a name="line181"></a>
<a name="line182"></a>  var fmt = new goog.i18n.NumberFormat(&#39;0.0;(0.0)&#39;);
<a name="line183"></a>  value = fmt.parse(&#39;123.4579%&#39;);
<a name="line184"></a>  assertEquals((123.4579 / 100), value);
<a name="line185"></a>
<a name="line186"></a>  value = fmt.parse(&#39;(%123.4579)&#39;);
<a name="line187"></a>  assertEquals((-123.4579 / 100), value);
<a name="line188"></a>
<a name="line189"></a>  value = fmt.parse(&#39;123.4579\u2030&#39;);
<a name="line190"></a>  assertEquals((123.4579 / 1000), value);
<a name="line191"></a>
<a name="line192"></a>  value = fmt.parse(&#39;(\u2030123.4579)&#39;);
<a name="line193"></a>  assertEquals((-123.4579 / 1000), value);
<a name="line194"></a>}
<a name="line195"></a>
<a name="line196"></a>function testPercentAndPerMillAdvance() {
<a name="line197"></a>  var value;
<a name="line198"></a>  var pos = [0];
<a name="line199"></a>  var fmt = new goog.i18n.NumberFormat(&#39;0&#39;);
<a name="line200"></a>  value = fmt.parse(&#39;120%&#39;, pos);
<a name="line201"></a>  assertEquals(1.2, value);
<a name="line202"></a>  assertEquals(4, pos[0]);
<a name="line203"></a>  pos[0] = 0;
<a name="line204"></a>  value = fmt.parse(&#39;120\u2030&#39;, pos);
<a name="line205"></a>  assertEquals(0.12, value);
<a name="line206"></a>  assertEquals(4, pos[0]);
<a name="line207"></a>}
<a name="line208"></a>
<a name="line209"></a>function testInfinityParse() {
<a name="line210"></a>  var value;
<a name="line211"></a>  var fmt = new goog.i18n.NumberFormat(&#39;0.0;(0.0)&#39;);
<a name="line212"></a>
<a name="line213"></a>  // gwt need to add those symbols first
<a name="line214"></a>  value = fmt.parse(&#39;\u221e&#39;);
<a name="line215"></a>  assertEquals(Number.POSITIVE_INFINITY, value);
<a name="line216"></a>
<a name="line217"></a>  value = fmt.parse(&#39;(\u221e)&#39;);
<a name="line218"></a>  assertEquals(Number.NEGATIVE_INFINITY, value);
<a name="line219"></a>}
<a name="line220"></a>function testExponentParse() {
<a name="line221"></a>  var value;
<a name="line222"></a>  var fmt;
<a name="line223"></a>
<a name="line224"></a>  fmt = new goog.i18n.NumberFormat(&#39;#E0&#39;);
<a name="line225"></a>  value = fmt.parse(&#39;1.234E3&#39;);
<a name="line226"></a>  assertEquals(1.234E+3, value);
<a name="line227"></a>
<a name="line228"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.###E0&#39;);
<a name="line229"></a>  value = fmt.parse(&#39;1.234E3&#39;);
<a name="line230"></a>  assertEquals(1.234E+3, value);
<a name="line231"></a>
<a name="line232"></a>  fmt = new goog.i18n.NumberFormat(&#39;#E0&#39;);
<a name="line233"></a>  value = fmt.parse(&#39;1.2345E4&#39;);
<a name="line234"></a>  assertEquals(12345.0, value);
<a name="line235"></a>
<a name="line236"></a>  value = fmt.parse(&#39;1.2345E4&#39;);
<a name="line237"></a>  assertEquals(12345.0, value);
<a name="line238"></a>
<a name="line239"></a>  value = fmt.parse(&#39;1.2345E+4&#39;);
<a name="line240"></a>  assertEquals(12345.0, value);
<a name="line241"></a>}
<a name="line242"></a>
<a name="line243"></a>function testGroupingParse() {
<a name="line244"></a>  var value;
<a name="line245"></a>
<a name="line246"></a>  var fmt = new goog.i18n.NumberFormat(&#39;#,###&#39;);
<a name="line247"></a>  value = fmt.parse(&#39;1,234,567,890&#39;);
<a name="line248"></a>  assertEquals(1234567890, value);
<a name="line249"></a>  value = fmt.parse(&#39;12,3456,7890&#39;);
<a name="line250"></a>  assertEquals(1234567890, value);
<a name="line251"></a>
<a name="line252"></a>  fmt = new goog.i18n.NumberFormat(&#39;#&#39;);
<a name="line253"></a>  value = fmt.parse(&#39;1234567890&#39;);
<a name="line254"></a>  assertEquals(1234567890, value);
<a name="line255"></a>}
<a name="line256"></a>
<a name="line257"></a>function testBasicFormat() {
<a name="line258"></a>  var fmt = new goog.i18n.NumberFormat(&#39;0.0000&#39;);
<a name="line259"></a>  var str = fmt.format(123.45789179565757);
<a name="line260"></a>  assertEquals(&#39;123.4579&#39;, str);
<a name="line261"></a>}
<a name="line262"></a>
<a name="line263"></a>function testGrouping() {
<a name="line264"></a>  var str;
<a name="line265"></a>
<a name="line266"></a>  var fmt = new goog.i18n.NumberFormat(&#39;#,###&#39;);
<a name="line267"></a>  str = fmt.format(1234567890);
<a name="line268"></a>  assertEquals(&#39;1,234,567,890&#39;, str);
<a name="line269"></a>  fmt = new goog.i18n.NumberFormat(&#39;#,####&#39;);
<a name="line270"></a>  str = fmt.format(1234567890);
<a name="line271"></a>  assertEquals(&#39;12,3456,7890&#39;, str);
<a name="line272"></a>
<a name="line273"></a>  fmt = new goog.i18n.NumberFormat(&#39;#&#39;);
<a name="line274"></a>  str = fmt.format(1234567890);
<a name="line275"></a>  assertEquals(&#39;1234567890&#39;, str);
<a name="line276"></a>}
<a name="line277"></a>
<a name="line278"></a>function testPerMill() {
<a name="line279"></a>  var str;
<a name="line280"></a>
<a name="line281"></a>  var fmt = new goog.i18n.NumberFormat(&#39;###.###\u2030&#39;);
<a name="line282"></a>  str = fmt.format(0.4857);
<a name="line283"></a>  assertEquals(&#39;485.7\u2030&#39;, str);
<a name="line284"></a>}
<a name="line285"></a>
<a name="line286"></a>function testCurrency() {
<a name="line287"></a>  var str;
<a name="line288"></a>
<a name="line289"></a>  var fmt = new goog.i18n.NumberFormat(&#39;\u00a4#,##0.00;-\u00a4#,##0.00&#39;);
<a name="line290"></a>  str = fmt.format(1234.56);
<a name="line291"></a>  assertEquals(&#39;$1,234.56&#39;, str);
<a name="line292"></a>  str = fmt.format(-1234.56);
<a name="line293"></a>  assertEquals(&#39;-$1,234.56&#39;, str);
<a name="line294"></a>
<a name="line295"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00a4#,##0.00;-\u00a4#,##0.00&#39;, &#39;USD&#39;,
<a name="line296"></a>      goog.i18n.NumberFormat.CurrencyStyle.LOCAL);
<a name="line297"></a>  str = fmt.format(1234.56);
<a name="line298"></a>  assertEquals(&#39;$1,234.56&#39;, str);
<a name="line299"></a>  str = fmt.format(-1234.56);
<a name="line300"></a>  assertEquals(&#39;-$1,234.56&#39;, str);
<a name="line301"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00a4#,##0.00;-\u00a4#,##0.00&#39;, &#39;USD&#39;,
<a name="line302"></a>      goog.i18n.NumberFormat.CurrencyStyle.PORTABLE);
<a name="line303"></a>  str = fmt.format(1234.56);
<a name="line304"></a>  assertEquals(&#39;US$1,234.56&#39;, str);
<a name="line305"></a>  str = fmt.format(-1234.56);
<a name="line306"></a>  assertEquals(&#39;-US$1,234.56&#39;, str);
<a name="line307"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00a4#,##0.00;-\u00a4#,##0.00&#39;, &#39;USD&#39;,
<a name="line308"></a>      goog.i18n.NumberFormat.CurrencyStyle.GLOBAL);
<a name="line309"></a>  str = fmt.format(1234.56);
<a name="line310"></a>  assertEquals(&#39;USD $1,234.56&#39;, str);
<a name="line311"></a>  str = fmt.format(-1234.56);
<a name="line312"></a>  assertEquals(&#39;-USD $1,234.56&#39;, str);
<a name="line313"></a>
<a name="line314"></a>
<a name="line315"></a>  fmt = new goog.i18n.NumberFormat(
<a name="line316"></a>      &#39;\u00a4\u00a4 #,##0.00;-\u00a4\u00a4 #,##0.00&#39;);
<a name="line317"></a>  str = fmt.format(1234.56);
<a name="line318"></a>  assertEquals(&#39;USD 1,234.56&#39;, str);
<a name="line319"></a>  fmt = new goog.i18n.NumberFormat(
<a name="line320"></a>      &#39;\u00a4\u00a4 #,##0.00;\u00a4\u00a4 -#,##0.00&#39;);
<a name="line321"></a>  str = fmt.format(-1234.56);
<a name="line322"></a>  assertEquals(&#39;USD -1,234.56&#39;, str);
<a name="line323"></a>
<a name="line324"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00a4#,##0.00;-\u00a4#,##0.00&#39;, &#39;BRL&#39;);
<a name="line325"></a>  str = fmt.format(1234.56);
<a name="line326"></a>  assertEquals(&#39;R$1,234.56&#39;, str);
<a name="line327"></a>  str = fmt.format(-1234.56);
<a name="line328"></a>  assertEquals(&#39;-R$1,234.56&#39;, str);
<a name="line329"></a>
<a name="line330"></a>  fmt = new goog.i18n.NumberFormat(
<a name="line331"></a>      &#39;\u00a4\u00a4 #,##0.00;(\u00a4\u00a4 #,##0.00)&#39;, &#39;BRL&#39;);
<a name="line332"></a>  str = fmt.format(1234.56);
<a name="line333"></a>  assertEquals(&#39;BRL 1,234.56&#39;, str);
<a name="line334"></a>  str = fmt.format(-1234.56);
<a name="line335"></a>  assertEquals(&#39;(BRL 1,234.56)&#39;, str);
<a name="line336"></a>}
<a name="line337"></a>
<a name="line338"></a>function testQuotes() {
<a name="line339"></a>  var str;
<a name="line340"></a>
<a name="line341"></a>  var fmt = new goog.i18n.NumberFormat(&#39;a\&#39;fo\&#39;\&#39;o\&#39;b#&#39;);
<a name="line342"></a>  str = fmt.format(123);
<a name="line343"></a>  assertEquals(&#39;afo\&#39;ob123&#39;, str);
<a name="line344"></a>
<a name="line345"></a>  fmt = new goog.i18n.NumberFormat(&#39;a\&#39;\&#39;b#&#39;);
<a name="line346"></a>  str = fmt.format(123);
<a name="line347"></a>  assertEquals(&#39;a\&#39;b123&#39;, str);
<a name="line348"></a>
<a name="line349"></a>  fmt = new goog.i18n.NumberFormat(&#39;a\&#39;fo\&#39;\&#39;o\&#39;b#&#39;);
<a name="line350"></a>  str = fmt.format(-123);
<a name="line351"></a>  assertEquals(&#39;afo\&#39;ob-123&#39;, str);
<a name="line352"></a>
<a name="line353"></a>  fmt = new goog.i18n.NumberFormat(&#39;a\&#39;\&#39;b#&#39;);
<a name="line354"></a>  str = fmt.format(-123);
<a name="line355"></a>  assertEquals(&#39;a\&#39;b-123&#39;, str);
<a name="line356"></a>}
<a name="line357"></a>
<a name="line358"></a>function testZeros() {
<a name="line359"></a>  var str;
<a name="line360"></a>  var fmt;
<a name="line361"></a>
<a name="line362"></a>  fmt = new goog.i18n.NumberFormat(&#39;#.#&#39;);
<a name="line363"></a>  str = fmt.format(0);
<a name="line364"></a>  assertEquals(&#39;0&#39;, str);
<a name="line365"></a>  fmt = new goog.i18n.NumberFormat(&#39;#.&#39;);
<a name="line366"></a>  str = fmt.format(0);
<a name="line367"></a>  assertEquals(&#39;0.&#39;, str);
<a name="line368"></a>  fmt = new goog.i18n.NumberFormat(&#39;.#&#39;);
<a name="line369"></a>  str = fmt.format(0);
<a name="line370"></a>  assertEquals(&#39;.0&#39;, str);
<a name="line371"></a>  fmt = new goog.i18n.NumberFormat(&#39;#&#39;);
<a name="line372"></a>  str = fmt.format(0);
<a name="line373"></a>  assertEquals(&#39;0&#39;, str);
<a name="line374"></a>
<a name="line375"></a>  fmt = new goog.i18n.NumberFormat(&#39;#0.#&#39;);
<a name="line376"></a>  str = fmt.format(0);
<a name="line377"></a>  assertEquals(&#39;0&#39;, str);
<a name="line378"></a>  fmt = new goog.i18n.NumberFormat(&#39;#0.&#39;);
<a name="line379"></a>  str = fmt.format(0);
<a name="line380"></a>  assertEquals(&#39;0.&#39;, str);
<a name="line381"></a>  fmt = new goog.i18n.NumberFormat(&#39;#.0&#39;);
<a name="line382"></a>  str = fmt.format(0);
<a name="line383"></a>  assertEquals(&#39;.0&#39;, str);
<a name="line384"></a>  fmt = new goog.i18n.NumberFormat(&#39;#&#39;);
<a name="line385"></a>  str = fmt.format(0);
<a name="line386"></a>  assertEquals(&#39;0&#39;, str);
<a name="line387"></a>  fmt = new goog.i18n.NumberFormat(&#39;000&#39;);
<a name="line388"></a>  str = fmt.format(0);
<a name="line389"></a>  assertEquals(&#39;000&#39;, str);
<a name="line390"></a>}
<a name="line391"></a>
<a name="line392"></a>function testExponential() {
<a name="line393"></a>  var str;
<a name="line394"></a>  var fmt;
<a name="line395"></a>
<a name="line396"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.####E0&#39;);
<a name="line397"></a>  str = fmt.format(0.01234);
<a name="line398"></a>  assertEquals(&#39;1.234E-2&#39;, str);
<a name="line399"></a>  fmt = new goog.i18n.NumberFormat(&#39;00.000E00&#39;);
<a name="line400"></a>  str = fmt.format(0.01234);
<a name="line401"></a>  assertEquals(&#39;12.340E-03&#39;, str);
<a name="line402"></a>  fmt = new goog.i18n.NumberFormat(&#39;##0.######E000&#39;);
<a name="line403"></a>  str = fmt.format(0.01234);
<a name="line404"></a>  assertEquals(&#39;12.34E-003&#39;, str);
<a name="line405"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.###E0;[0.###E0]&#39;);
<a name="line406"></a>  str = fmt.format(0.01234);
<a name="line407"></a>  assertEquals(&#39;1.234E-2&#39;, str);
<a name="line408"></a>
<a name="line409"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.####E0&#39;);
<a name="line410"></a>  str = fmt.format(123456789);
<a name="line411"></a>  assertEquals(&#39;1.2346E8&#39;, str);
<a name="line412"></a>  fmt = new goog.i18n.NumberFormat(&#39;00.000E00&#39;);
<a name="line413"></a>  str = fmt.format(123456789);
<a name="line414"></a>  assertEquals(&#39;12.346E07&#39;, str);
<a name="line415"></a>  fmt = new goog.i18n.NumberFormat(&#39;##0.######E000&#39;);
<a name="line416"></a>  str = fmt.format(123456789);
<a name="line417"></a>  assertEquals(&#39;123.456789E006&#39;, str);
<a name="line418"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.###E0;[0.###E0]&#39;);
<a name="line419"></a>  str = fmt.format(123456789);
<a name="line420"></a>  assertEquals(&#39;1.235E8&#39;, str);
<a name="line421"></a>
<a name="line422"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.####E0&#39;);
<a name="line423"></a>  str = fmt.format(1.23e300);
<a name="line424"></a>  assertEquals(&#39;1.23E300&#39;, str);
<a name="line425"></a>  fmt = new goog.i18n.NumberFormat(&#39;00.000E00&#39;);
<a name="line426"></a>  str = fmt.format(1.23e300);
<a name="line427"></a>  assertEquals(&#39;12.300E299&#39;, str);
<a name="line428"></a>  fmt = new goog.i18n.NumberFormat(&#39;##0.######E000&#39;);
<a name="line429"></a>  str = fmt.format(1.23e300);
<a name="line430"></a>  assertEquals(&#39;1.23E300&#39;, str);
<a name="line431"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.###E0;[0.###E0]&#39;);
<a name="line432"></a>  str = fmt.format(1.23e300);
<a name="line433"></a>  assertEquals(&#39;1.23E300&#39;, str);
<a name="line434"></a>
<a name="line435"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.####E0&#39;);
<a name="line436"></a>  str = fmt.format(-3.141592653e-271);
<a name="line437"></a>  assertEquals(&#39;-3.1416E-271&#39;, str);
<a name="line438"></a>  fmt = new goog.i18n.NumberFormat(&#39;00.000E00&#39;);
<a name="line439"></a>  str = fmt.format(-3.141592653e-271);
<a name="line440"></a>  assertEquals(&#39;-31.416E-272&#39;, str);
<a name="line441"></a>  fmt = new goog.i18n.NumberFormat(&#39;##0.######E000&#39;);
<a name="line442"></a>  str = fmt.format(-3.141592653e-271);
<a name="line443"></a>  assertEquals(&#39;-314.159265E-273&#39;, str);
<a name="line444"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.###E0;[0.###E0]&#39;);
<a name="line445"></a>  str = fmt.format(-3.141592653e-271);
<a name="line446"></a>  assertEquals(&#39;[3.142E-271]&#39;, str);
<a name="line447"></a>
<a name="line448"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.####E0&#39;);
<a name="line449"></a>  str = fmt.format(0);
<a name="line450"></a>  assertEquals(&#39;0E0&#39;, str);
<a name="line451"></a>  fmt = new goog.i18n.NumberFormat(&#39;00.000E00&#39;);
<a name="line452"></a>  str = fmt.format(0);
<a name="line453"></a>  assertEquals(&#39;00.000E00&#39;, str);
<a name="line454"></a>  fmt = new goog.i18n.NumberFormat(&#39;##0.######E000&#39;);
<a name="line455"></a>  str = fmt.format(0);
<a name="line456"></a>  assertEquals(&#39;0E000&#39;, str);
<a name="line457"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.###E0;[0.###E0]&#39;);
<a name="line458"></a>  str = fmt.format(0);
<a name="line459"></a>  assertEquals(&#39;0E0&#39;, str);
<a name="line460"></a>
<a name="line461"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.####E0&#39;);
<a name="line462"></a>  str = fmt.format(-1);
<a name="line463"></a>  assertEquals(&#39;-1E0&#39;, str);
<a name="line464"></a>  fmt = new goog.i18n.NumberFormat(&#39;00.000E00&#39;);
<a name="line465"></a>  str = fmt.format(-1);
<a name="line466"></a>  assertEquals(&#39;-10.000E-01&#39;, str);
<a name="line467"></a>  fmt = new goog.i18n.NumberFormat(&#39;##0.######E000&#39;);
<a name="line468"></a>  str = fmt.format(-1);
<a name="line469"></a>  assertEquals(&#39;-1E000&#39;, str);
<a name="line470"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.###E0;[0.###E0]&#39;);
<a name="line471"></a>  str = fmt.format(-1);
<a name="line472"></a>  assertEquals(&#39;[1E0]&#39;, str);
<a name="line473"></a>
<a name="line474"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.####E0&#39;);
<a name="line475"></a>  str = fmt.format(1);
<a name="line476"></a>  assertEquals(&#39;1E0&#39;, str);
<a name="line477"></a>  fmt = new goog.i18n.NumberFormat(&#39;00.000E00&#39;);
<a name="line478"></a>  str = fmt.format(1);
<a name="line479"></a>  assertEquals(&#39;10.000E-01&#39;, str);
<a name="line480"></a>  fmt = new goog.i18n.NumberFormat(&#39;##0.######E000&#39;);
<a name="line481"></a>  str = fmt.format(1);
<a name="line482"></a>  assertEquals(&#39;1E000&#39;, str);
<a name="line483"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.###E0;[0.###E0]&#39;);
<a name="line484"></a>  str = fmt.format(1);
<a name="line485"></a>  assertEquals(&#39;1E0&#39;, str);
<a name="line486"></a>
<a name="line487"></a>  fmt = new goog.i18n.NumberFormat(&#39;#E0&#39;);
<a name="line488"></a>  str = fmt.format(12345.0);
<a name="line489"></a>  assertEquals(&#39;1E4&#39;, str);
<a name="line490"></a>  fmt = new goog.i18n.NumberFormat(&#39;0E0&#39;);
<a name="line491"></a>  str = fmt.format(12345.0);
<a name="line492"></a>  assertEquals(&#39;1E4&#39;, str);
<a name="line493"></a>  fmt = new goog.i18n.NumberFormat(&#39;##0.###E0&#39;);
<a name="line494"></a>  str = fmt.format(12345.0);
<a name="line495"></a>  assertEquals(&#39;12.345E3&#39;, str);
<a name="line496"></a>  fmt = new goog.i18n.NumberFormat(&#39;##0.###E0&#39;);
<a name="line497"></a>  str = fmt.format(12345.00001);
<a name="line498"></a>  assertEquals(&#39;12.345E3&#39;, str);
<a name="line499"></a>  fmt = new goog.i18n.NumberFormat(&#39;##0.###E0&#39;);
<a name="line500"></a>  str = fmt.format(12345);
<a name="line501"></a>  assertEquals(&#39;12.345E3&#39;, str);
<a name="line502"></a>
<a name="line503"></a>  fmt = new goog.i18n.NumberFormat(&#39;##0.####E0&#39;);
<a name="line504"></a>  str = fmt.format(789.12345e-9);
<a name="line505"></a>  // Firefox 3.6.3 Linux is known to fail here with a rounding error.
<a name="line506"></a>  // fmt.format will return &#39;789.1234E-9&#39;.
<a name="line507"></a>  expectedFailures.expectFailureFor(isFirefox363Linux());
<a name="line508"></a>  try {
<a name="line509"></a>    assertEquals(&#39;789.1235E-9&#39;, str);
<a name="line510"></a>  } catch (e) {
<a name="line511"></a>    expectedFailures.handleException(e);
<a name="line512"></a>  }
<a name="line513"></a>  fmt = new goog.i18n.NumberFormat(&#39;##0.####E0&#39;);
<a name="line514"></a>  str = fmt.format(780.e-9);
<a name="line515"></a>  assertEquals(&#39;780E-9&#39;, str);
<a name="line516"></a>  fmt = new goog.i18n.NumberFormat(&#39;.###E0&#39;);
<a name="line517"></a>  str = fmt.format(45678.0);
<a name="line518"></a>  assertEquals(&#39;.457E5&#39;, str);
<a name="line519"></a>  fmt = new goog.i18n.NumberFormat(&#39;.###E0&#39;);
<a name="line520"></a>  str = fmt.format(0);
<a name="line521"></a>  assertEquals(&#39;.0E0&#39;, str);
<a name="line522"></a>
<a name="line523"></a>  fmt = new goog.i18n.NumberFormat(&#39;#E0&#39;);
<a name="line524"></a>  str = fmt.format(45678000);
<a name="line525"></a>  assertEquals(&#39;5E7&#39;, str);
<a name="line526"></a>  fmt = new goog.i18n.NumberFormat(&#39;##E0&#39;);
<a name="line527"></a>  str = fmt.format(45678000);
<a name="line528"></a>  assertEquals(&#39;46E6&#39;, str);
<a name="line529"></a>  fmt = new goog.i18n.NumberFormat(&#39;####E0&#39;);
<a name="line530"></a>  str = fmt.format(45678000);
<a name="line531"></a>  assertEquals(&#39;4568E4&#39;, str);
<a name="line532"></a>  fmt = new goog.i18n.NumberFormat(&#39;0E0&#39;);
<a name="line533"></a>  str = fmt.format(45678000);
<a name="line534"></a>  assertEquals(&#39;5E7&#39;, str);
<a name="line535"></a>  fmt = new goog.i18n.NumberFormat(&#39;00E0&#39;);
<a name="line536"></a>  str = fmt.format(45678000);
<a name="line537"></a>  assertEquals(&#39;46E6&#39;, str);
<a name="line538"></a>  fmt = new goog.i18n.NumberFormat(&#39;000E0&#39;);
<a name="line539"></a>  str = fmt.format(45678000);
<a name="line540"></a>  assertEquals(&#39;457E5&#39;, str);
<a name="line541"></a>  fmt = new goog.i18n.NumberFormat(&#39;###E0&#39;);
<a name="line542"></a>  str = fmt.format(0.0000123);
<a name="line543"></a>  assertEquals(&#39;12E-6&#39;, str);
<a name="line544"></a>  fmt = new goog.i18n.NumberFormat(&#39;###E0&#39;);
<a name="line545"></a>  str = fmt.format(0.000123);
<a name="line546"></a>  assertEquals(&#39;123E-6&#39;, str);
<a name="line547"></a>  fmt = new goog.i18n.NumberFormat(&#39;###E0&#39;);
<a name="line548"></a>  str = fmt.format(0.00123);
<a name="line549"></a>  assertEquals(&#39;1E-3&#39;, str);
<a name="line550"></a>  fmt = new goog.i18n.NumberFormat(&#39;###E0&#39;);
<a name="line551"></a>  str = fmt.format(0.0123);
<a name="line552"></a>  assertEquals(&#39;12E-3&#39;, str);
<a name="line553"></a>  fmt = new goog.i18n.NumberFormat(&#39;###E0&#39;);
<a name="line554"></a>  str = fmt.format(0.123);
<a name="line555"></a>  assertEquals(&#39;123E-3&#39;, str);
<a name="line556"></a>  fmt = new goog.i18n.NumberFormat(&#39;###E0&#39;);
<a name="line557"></a>  str = fmt.format(1.23);
<a name="line558"></a>  assertEquals(&#39;1E0&#39;, str);
<a name="line559"></a>  fmt = new goog.i18n.NumberFormat(&#39;###E0&#39;);
<a name="line560"></a>  str = fmt.format(12.3);
<a name="line561"></a>  assertEquals(&#39;12E0&#39;, str);
<a name="line562"></a>  fmt = new goog.i18n.NumberFormat(&#39;###E0&#39;);
<a name="line563"></a>  str = fmt.format(123.0);
<a name="line564"></a>  assertEquals(&#39;123E0&#39;, str);
<a name="line565"></a>  fmt = new goog.i18n.NumberFormat(&#39;###E0&#39;);
<a name="line566"></a>  str = fmt.format(1230.0);
<a name="line567"></a>  assertEquals(&#39;1E3&#39;, str);
<a name="line568"></a>}
<a name="line569"></a>
<a name="line570"></a>function testPlusSignInExponentPart() {
<a name="line571"></a>  var fmt;
<a name="line572"></a>  fmt = new goog.i18n.NumberFormat(&#39;0E+0&#39;);
<a name="line573"></a>  str = fmt.format(45678000);
<a name="line574"></a>  assertEquals(&#39;5E+7&#39;, str);
<a name="line575"></a>}
<a name="line576"></a>
<a name="line577"></a>function testGroupingParse2() {
<a name="line578"></a>  var value;
<a name="line579"></a>  var fmt;
<a name="line580"></a>
<a name="line581"></a>  fmt = new goog.i18n.NumberFormat(&#39;#,###&#39;);
<a name="line582"></a>  value = fmt.parse(&#39;1,234,567,890&#39;);
<a name="line583"></a>  assertEquals(1234567890, value);
<a name="line584"></a>  fmt = new goog.i18n.NumberFormat(&#39;#,###&#39;);
<a name="line585"></a>  value = fmt.parse(&#39;12,3456,7890&#39;);
<a name="line586"></a>  assertEquals(1234567890, value);
<a name="line587"></a>
<a name="line588"></a>  fmt = new goog.i18n.NumberFormat(&#39;#&#39;);
<a name="line589"></a>  value = fmt.parse(&#39;1234567890&#39;);
<a name="line590"></a>  assertEquals(1234567890, value);
<a name="line591"></a>}
<a name="line592"></a>
<a name="line593"></a>function testApis() {
<a name="line594"></a>  var fmt;
<a name="line595"></a>  var str;
<a name="line596"></a>
<a name="line597"></a>  fmt = new goog.i18n.NumberFormat(&#39;#,###&#39;);
<a name="line598"></a>  str = fmt.format(1234567890);
<a name="line599"></a>  assertEquals(&#39;1,234,567,890&#39;, str);
<a name="line600"></a>
<a name="line601"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00a4#,##0.00;-\u00a4#,##0.00&#39;);
<a name="line602"></a>  str = fmt.format(1234.56);
<a name="line603"></a>  assertEquals(&#39;$1,234.56&#39;, str);
<a name="line604"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00a4#,##0.00;(\u00a4#,##0.00)&#39;);
<a name="line605"></a>  str = fmt.format(-1234.56);
<a name="line606"></a>  assertEquals(&#39;($1,234.56)&#39;, str);
<a name="line607"></a>
<a name="line608"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00a4#,##0.00;-\u00a4#,##0.00&#39;, &#39;SEK&#39;);
<a name="line609"></a>  str = fmt.format(1234.56);
<a name="line610"></a>  assertEquals(&#39;kr1,234.56&#39;, str);
<a name="line611"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00a4#,##0.00;(\u00a4#,##0.00)&#39;, &#39;SEK&#39;);
<a name="line612"></a>  str = fmt.format(-1234.56);
<a name="line613"></a>  assertEquals(&#39;(kr1,234.56)&#39;, str);
<a name="line614"></a>}
<a name="line615"></a>
<a name="line616"></a>function testLocaleSwitch() {
<a name="line617"></a>  goog.i18n.NumberFormatSymbols = goog.i18n.NumberFormatSymbols_fr;
<a name="line618"></a>
<a name="line619"></a>  // When this test is performed in test cluster, 2 out of 60 machines have
<a name="line620"></a>  // problem getting the symbol. It is likely to be caused by size of uncompiled
<a name="line621"></a>  // symbol file. There will not be an issue after it is compiled.
<a name="line622"></a>  if (goog.i18n.NumberFormatSymbols.DECIMAL_SEP ==
<a name="line623"></a>      goog.i18n.NumberFormatSymbols_en.DECIMAL_SEP) {
<a name="line624"></a>    // fails to load French symbols, skip the test.
<a name="line625"></a>    return;
<a name="line626"></a>  }
<a name="line627"></a>
<a name="line628"></a>  var fmt = new goog.i18n.NumberFormat(&#39;#,###&#39;);
<a name="line629"></a>  var str = fmt.format(1234567890);
<a name="line630"></a>  assertEquals(&#39;1\u00a0234\u00a0567\u00a0890&#39;, str);
<a name="line631"></a>
<a name="line632"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00a4#,##0.00;-\u00a4#,##0.00&#39;);
<a name="line633"></a>  str = fmt.format(1234.56);
<a name="line634"></a>  assertEquals(&#39;\u20AC1\u00a0234,56&#39;, str);
<a name="line635"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00a4#,##0.00;(\u00a4#,##0.00)&#39;);
<a name="line636"></a>  str = fmt.format(-1234.56);
<a name="line637"></a>  assertEquals(&#39;(\u20AC1\u00a0234,56)&#39;, str);
<a name="line638"></a>
<a name="line639"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00a4#,##0.00;-\u00a4#,##0.00&#39;, &#39;SEK&#39;);
<a name="line640"></a>  str = fmt.format(1234.56);
<a name="line641"></a>  assertEquals(&#39;kr1\u00a0234,56&#39;, str);
<a name="line642"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00a4#,##0.00;(\u00a4#,##0.00)&#39;, &#39;SEK&#39;);
<a name="line643"></a>  str = fmt.format(-1234.56);
<a name="line644"></a>  assertEquals(&#39;(kr1\u00a0234,56)&#39;, str);
<a name="line645"></a>}
<a name="line646"></a>
<a name="line647"></a>function testFrenchParse() {
<a name="line648"></a>  goog.i18n.NumberFormatSymbols = goog.i18n.NumberFormatSymbols_fr;
<a name="line649"></a>
<a name="line650"></a>  // When this test is performed in test cluster, 2 out of 60 machines have
<a name="line651"></a>  // problem getting the symbol. It is likely to be caused by size of uncompiled
<a name="line652"></a>  // symbol file. There will not be an issue after it is compiled.
<a name="line653"></a>  if (goog.i18n.NumberFormatSymbols.DECIMAL_SEP ==
<a name="line654"></a>      goog.i18n.NumberFormatSymbols_en.DECIMAL_SEP) {
<a name="line655"></a>    // fails to load French symbols, skip the test.
<a name="line656"></a>    return;
<a name="line657"></a>  }
<a name="line658"></a>
<a name="line659"></a>  var fmt = new goog.i18n.NumberFormat(&#39;0.0000&#39;);
<a name="line660"></a>  var value = fmt.parse(&#39;0,30&#39;);
<a name="line661"></a>  assertEquals(0.30, value);
<a name="line662"></a>
<a name="line663"></a>  fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.CURRENCY);
<a name="line664"></a>  value = fmt.parse(&#39;0,30\u00A0\u20AC&#39;);
<a name="line665"></a>  assertEquals(0.30, value);
<a name="line666"></a>  fmt = new goog.i18n.NumberFormat(&#39;#,##0.00&#39;);
<a name="line667"></a>  value = fmt.parse(&#39;123 456,99&#39;);
<a name="line668"></a>  assertEquals(123456.99, value);
<a name="line669"></a>
<a name="line670"></a>  fmt = new goog.i18n.NumberFormat(&#39;#,##0.00&#39;);
<a name="line671"></a>  value = fmt.parse(&#39;123\u00a0456,99&#39;);
<a name="line672"></a>  assertEquals(123456.99, value);
<a name="line673"></a>
<a name="line674"></a>  fmt = new goog.i18n.NumberFormat(&#39;#,##0.00&#39;);
<a name="line675"></a>  value = fmt.parse(&#39;8 123\u00a0456,99&#39;);
<a name="line676"></a>  assertEquals(8123456.99, value);
<a name="line677"></a>}
<a name="line678"></a>
<a name="line679"></a>
<a name="line680"></a>function testFailParseShouldThrow() {
<a name="line681"></a>  var fmt = new goog.i18n.NumberFormat(&#39;0.0000&#39;);
<a name="line682"></a>  var value = fmt.parse(&#39;x&#39;);
<a name="line683"></a>  assertNaN(value);
<a name="line684"></a>
<a name="line685"></a>  fmt = new goog.i18n.NumberFormat(&#39;0.000x&#39;);
<a name="line686"></a>  value = fmt.parse(&#39;3y&#39;);
<a name="line687"></a>  assertNaN(value);
<a name="line688"></a>
<a name="line689"></a>  fmt = new goog.i18n.NumberFormat(&#39;x0.000&#39;);
<a name="line690"></a>  value = fmt.parse(&#39;y3&#39;);
<a name="line691"></a>  assertNaN(value);
<a name="line692"></a>}
<a name="line693"></a>
<a name="line694"></a>
<a name="line695"></a>/**
<a name="line696"></a> * @return {boolean} Whether we&#39;re on Linux Firefox 3.6.3.
<a name="line697"></a> */
<a name="line698"></a>function isFirefox363Linux() {
<a name="line699"></a>  return goog.userAgent.product.FIREFOX &amp;&amp; goog.userAgent.LINUX &amp;&amp;
<a name="line700"></a>      goog.userAgent.product.isVersion(&#39;3.6.3&#39;) &amp;&amp;
<a name="line701"></a>      !goog.userAgent.product.isVersion(&#39;3.6.4&#39;);
<a name="line702"></a>}
<a name="line703"></a>
<a name="line704"></a>
<a name="line705"></a>function testEnforceAscii() {
<a name="line706"></a>  try {
<a name="line707"></a>    goog.i18n.NumberFormatSymbols.ZERO_DIGIT = &#39;A&#39;;
<a name="line708"></a>    var fmt = new goog.i18n.NumberFormat(&#39;0.0000&#39;);
<a name="line709"></a>    var str = fmt.format(123.45789179565757);
<a name="line710"></a>    assertEquals(&#39;BCD.EFHJ&#39;, str);
<a name="line711"></a>    goog.i18n.NumberFormat.setEnforceAsciiDigits(true);
<a name="line712"></a>    str = fmt.format(123.45789179565757);
<a name="line713"></a>    assertEquals(&#39;123.4579&#39;, str);
<a name="line714"></a>    goog.i18n.NumberFormat.setEnforceAsciiDigits(false);
<a name="line715"></a>    str = fmt.format(123.45789179565757);
<a name="line716"></a>    assertEquals(&#39;BCD.EFHJ&#39;, str);
<a name="line717"></a>  } finally {
<a name="line718"></a>    goog.i18n.NumberFormatSymbols.ZERO_DIGIT = &#39;0&#39;;
<a name="line719"></a>  }
<a name="line720"></a>}
<a name="line721"></a>
<a name="line722"></a>function testFractionDigits() {
<a name="line723"></a>  var fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.DECIMAL);
<a name="line724"></a>  fmt.setMinimumFractionDigits(4);
<a name="line725"></a>  fmt.setMaximumFractionDigits(6);
<a name="line726"></a>  assertEquals(&#39;0.1230&#39;, fmt.format(0.123));
<a name="line727"></a>  assertEquals(&#39;0.123456&#39;, fmt.format(0.123456));
<a name="line728"></a>  assertEquals(&#39;0.123457&#39;, fmt.format(0.12345678));
<a name="line729"></a>}
<a name="line730"></a>
<a name="line731"></a>function testFractionDigitsSetOutOfOrder() {
<a name="line732"></a>  var fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.DECIMAL);
<a name="line733"></a>  // First, setup basic min/max
<a name="line734"></a>  fmt.setMinimumFractionDigits(2);
<a name="line735"></a>  fmt.setMaximumFractionDigits(2);
<a name="line736"></a>  // Now change to a lower min &amp; max, but change the max value first so that it
<a name="line737"></a>  // is temporarily less than the current &quot;min&quot; value.  This makes sure that we
<a name="line738"></a>  // don&#39;t throw an error.
<a name="line739"></a>  fmt.setMaximumFractionDigits(1);
<a name="line740"></a>  fmt.setMinimumFractionDigits(1);
<a name="line741"></a>  assertEquals(&#39;2.3&#39;, fmt.format(2.34));
<a name="line742"></a>}
<a name="line743"></a>
<a name="line744"></a>function testFractionDigitsInvalid() {
<a name="line745"></a>  var fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.DECIMAL);
<a name="line746"></a>  fmt.setMinimumFractionDigits(2);
<a name="line747"></a>  fmt.setMaximumFractionDigits(1);
<a name="line748"></a>  try {
<a name="line749"></a>    fmt.format(0.123);
<a name="line750"></a>    fail(&#39;Should have thrown exception.&#39;);
<a name="line751"></a>  } catch (e) {}
<a name="line752"></a>}
<a name="line753"></a>
<a name="line754"></a>function testSignificantDigitsEqualToMax() {
<a name="line755"></a>  var fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.DECIMAL);
<a name="line756"></a>  fmt.setMinimumFractionDigits(0);
<a name="line757"></a>  fmt.setMaximumFractionDigits(2);
<a name="line758"></a>
<a name="line759"></a>  fmt.setSignificantDigits(2);
<a name="line760"></a>  assertEquals(&#39;123&#39;, fmt.format(123.4));
<a name="line761"></a>  assertEquals(&#39;12&#39;, fmt.format(12.34));
<a name="line762"></a>  assertEquals(&#39;1.2&#39;, fmt.format(1.234));
<a name="line763"></a>  assertEquals(&#39;0.12&#39;, fmt.format(0.1234));
<a name="line764"></a>}
<a name="line765"></a>
<a name="line766"></a>function testSignificantDigitsLessThanMax() {
<a name="line767"></a>  var fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.DECIMAL);
<a name="line768"></a>  fmt.setMinimumFractionDigits(0);
<a name="line769"></a>  fmt.setMaximumFractionDigits(4);
<a name="line770"></a>  fmt.setSignificantDigits(1);
<a name="line771"></a>
<a name="line772"></a>  assertEquals(&#39;123&#39;, fmt.format(123.4));
<a name="line773"></a>  assertEquals(&#39;12&#39;, fmt.format(12.34));
<a name="line774"></a>  assertEquals(&#39;1&#39;, fmt.format(1.234));
<a name="line775"></a>  assertEquals(&#39;0.1&#39;, fmt.format(0.1234));
<a name="line776"></a>}
<a name="line777"></a>
<a name="line778"></a>function testSignificantDigitsMoreThanMax() {
<a name="line779"></a>  // Max fractional digits should be absolute
<a name="line780"></a>  var fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.DECIMAL);
<a name="line781"></a>  fmt.setMinimumFractionDigits(0);
<a name="line782"></a>  fmt.setMaximumFractionDigits(2);
<a name="line783"></a>  fmt.setSignificantDigits(3);
<a name="line784"></a>
<a name="line785"></a>  assertEquals(&#39;123&#39;, fmt.format(123.4));
<a name="line786"></a>  assertEquals(&#39;12.3&#39;, fmt.format(12.34));
<a name="line787"></a>  assertEquals(&#39;1.23&#39;, fmt.format(1.234));
<a name="line788"></a>  assertEquals(&#39;0.12&#39;, fmt.format(0.1234));
<a name="line789"></a>}
<a name="line790"></a>
<a name="line791"></a>function testSimpleCompactFrench() {
<a name="line792"></a>  // Switch to French.
<a name="line793"></a>  goog.i18n.NumberFormatSymbols = goog.i18n.NumberFormatSymbols_fr;
<a name="line794"></a>  goog.i18n.CompactNumberFormatSymbols =
<a name="line795"></a>      goog.i18n.CompactNumberFormatSymbols_fr;
<a name="line796"></a>
<a name="line797"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line798"></a>      goog.i18n.NumberFormat.Format.COMPACT_SHORT);
<a name="line799"></a>
<a name="line800"></a>  var str = fmt.format(123400000);
<a name="line801"></a>  assertEquals(&#39;123\u00A0M&#39;, str);
<a name="line802"></a>}
<a name="line803"></a>
<a name="line804"></a>function testSimpleCompactGerman() {
<a name="line805"></a>  // Switch to German.
<a name="line806"></a>  goog.i18n.NumberFormatSymbols = goog.i18n.NumberFormatSymbols_de;
<a name="line807"></a>  goog.i18n.CompactNumberFormatSymbols =
<a name="line808"></a>      goog.i18n.CompactNumberFormatSymbols_de;
<a name="line809"></a>
<a name="line810"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line811"></a>      goog.i18n.NumberFormat.Format.COMPACT_SHORT);
<a name="line812"></a>
<a name="line813"></a>  // The german short compact decimal has a simple &#39;0&#39; for 1000&#39;s, which is
<a name="line814"></a>  // supposed to be interpreted as &#39;leave the number as-is&#39;.
<a name="line815"></a>  // (The number itself will still be formatted with the &#39;.&#39;, but no rounding)
<a name="line816"></a>  var str = fmt.format(1234);
<a name="line817"></a>  assertEquals(&#39;1,2\u00A0Tsd&#39;, str);
<a name="line818"></a>}
<a name="line819"></a>
<a name="line820"></a>function testSimpleCompact1() {
<a name="line821"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line822"></a>      goog.i18n.NumberFormat.Format.COMPACT_SHORT);
<a name="line823"></a>
<a name="line824"></a>  var str = fmt.format(1234);
<a name="line825"></a>  assertEquals(&#39;1.2K&#39;, str);
<a name="line826"></a>}
<a name="line827"></a>
<a name="line828"></a>function testSimpleCompact2() {
<a name="line829"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line830"></a>      goog.i18n.NumberFormat.Format.COMPACT_SHORT);
<a name="line831"></a>
<a name="line832"></a>  var str = fmt.format(12345);
<a name="line833"></a>  assertEquals(&#39;12K&#39;, str);
<a name="line834"></a>}
<a name="line835"></a>
<a name="line836"></a>function testRoundingCompact() {
<a name="line837"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line838"></a>      goog.i18n.NumberFormat.Format.COMPACT_SHORT);
<a name="line839"></a>
<a name="line840"></a>  var str = fmt.format(999999);
<a name="line841"></a>  assertEquals(&#39;1M&#39;, str); //as opposed to 1000k
<a name="line842"></a>}
<a name="line843"></a>
<a name="line844"></a>function testRoundingCompactNegative() {
<a name="line845"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line846"></a>      goog.i18n.NumberFormat.Format.COMPACT_SHORT);
<a name="line847"></a>
<a name="line848"></a>  var str = fmt.format(-999999);
<a name="line849"></a>  assertEquals(&#39;-1M&#39;, str);
<a name="line850"></a>}
<a name="line851"></a>
<a name="line852"></a>function testCompactSmall() {
<a name="line853"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line854"></a>      goog.i18n.NumberFormat.Format.COMPACT_SHORT);
<a name="line855"></a>
<a name="line856"></a>  var str = fmt.format(0.1234);
<a name="line857"></a>  assertEquals(&#39;0.12&#39;, str);
<a name="line858"></a>}
<a name="line859"></a>
<a name="line860"></a>function testCompactLong() {
<a name="line861"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line862"></a>      goog.i18n.NumberFormat.Format.COMPACT_LONG);
<a name="line863"></a>
<a name="line864"></a>  var str = fmt.format(12345);
<a name="line865"></a>  assertEquals(&#39;12 thousand&#39;, str);
<a name="line866"></a>}
<a name="line867"></a>
<a name="line868"></a>function testCompactWithoutSignificant() {
<a name="line869"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line870"></a>      goog.i18n.NumberFormat.Format.COMPACT_SHORT);
<a name="line871"></a>  fmt.setSignificantDigits(0);
<a name="line872"></a>  fmt.setMinimumFractionDigits(2);
<a name="line873"></a>  fmt.setMaximumFractionDigits(2);
<a name="line874"></a>
<a name="line875"></a>  assertEquals(&#39;1.23K&#39;, fmt.format(1234));
<a name="line876"></a>  assertEquals(&#39;1.00K&#39;, fmt.format(1000));
<a name="line877"></a>  assertEquals(&#39;123.46K&#39;, fmt.format(123456.7));
<a name="line878"></a>  assertEquals(&#39;999.99K&#39;, fmt.format(999994));
<a name="line879"></a>  assertEquals(&#39;1.00M&#39;, fmt.format(999995));
<a name="line880"></a>}
<a name="line881"></a>
<a name="line882"></a>function testCompactWithoutSignificant2() {
<a name="line883"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line884"></a>      goog.i18n.NumberFormat.Format.COMPACT_SHORT);
<a name="line885"></a>  fmt.setSignificantDigits(0);
<a name="line886"></a>  fmt.setMinimumFractionDigits(0);
<a name="line887"></a>  fmt.setMaximumFractionDigits(2);
<a name="line888"></a>
<a name="line889"></a>  assertEquals(&#39;1.23K&#39;, fmt.format(1234));
<a name="line890"></a>  assertEquals(&#39;1K&#39;, fmt.format(1000));
<a name="line891"></a>  assertEquals(&#39;123.46K&#39;, fmt.format(123456.7));
<a name="line892"></a>  assertEquals(&#39;999.99K&#39;, fmt.format(999994));
<a name="line893"></a>  assertEquals(&#39;1M&#39;, fmt.format(999995));
<a name="line894"></a>}
<a name="line895"></a>
<a name="line896"></a>function testShowTrailingZerosWithSignificantDigits() {
<a name="line897"></a>  var fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.DECIMAL);
<a name="line898"></a>  fmt.setSignificantDigits(2);
<a name="line899"></a>  fmt.setShowTrailingZeros(true);
<a name="line900"></a>
<a name="line901"></a>  assertEquals(&#39;2.0&#39;, fmt.format(2));
<a name="line902"></a>  assertEquals(&#39;2,000&#39;, fmt.format(2000));
<a name="line903"></a>  assertEquals(&#39;0.20&#39;, fmt.format(0.2));
<a name="line904"></a>  assertEquals(&#39;0.02&#39;, fmt.format(0.02));
<a name="line905"></a>  assertEquals(&#39;0.002&#39;, fmt.format(0.002));
<a name="line906"></a>  assertEquals(&#39;0.00&#39;, fmt.format(0));
<a name="line907"></a>
<a name="line908"></a>  fmt.setShowTrailingZeros(false);
<a name="line909"></a>  assertEquals(&#39;2&#39;, fmt.format(2));
<a name="line910"></a>  assertEquals(&#39;0.2&#39;, fmt.format(0.2));
<a name="line911"></a>}
<a name="line912"></a>
<a name="line913"></a>
<a name="line914"></a>function testShowTrailingZerosWithSignificantDigitsCompactShort() {
<a name="line915"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line916"></a>      goog.i18n.NumberFormat.Format.COMPACT_SHORT);
<a name="line917"></a>  fmt.setSignificantDigits(2);
<a name="line918"></a>  fmt.setShowTrailingZeros(true);
<a name="line919"></a>
<a name="line920"></a>  assertEquals(&#39;2.0&#39;, fmt.format(2));
<a name="line921"></a>  assertEquals(&#39;2.0K&#39;, fmt.format(2000));
<a name="line922"></a>  assertEquals(&#39;20&#39;, fmt.format(20));
<a name="line923"></a>}
<a name="line924"></a>
<a name="line925"></a>function testCurrencyCodeOrder() {
<a name="line926"></a>  goog.i18n.NumberFormatSymbols = goog.i18n.NumberFormatSymbols_fr;
<a name="line927"></a>  goog.i18n.CompactNumberFormatSymbols =
<a name="line928"></a>      goog.i18n.CompactNumberFormatSymbols_fr;
<a name="line929"></a>  var fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.CURRENCY);
<a name="line930"></a>  assertFalse(fmt.isCurrencyCodeBeforeValue());
<a name="line931"></a>
<a name="line932"></a>  goog.i18n.NumberFormatSymbols = goog.i18n.NumberFormatSymbols_en;
<a name="line933"></a>  goog.i18n.CompactNumberFormatSymbols =
<a name="line934"></a>      goog.i18n.CompactNumberFormatSymbols_en;
<a name="line935"></a>  var fmt1 = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.CURRENCY);
<a name="line936"></a>  assertTrue(fmt1.isCurrencyCodeBeforeValue());
<a name="line937"></a>
<a name="line938"></a>  // Check that we really have different formatters with different patterns
<a name="line939"></a>  assertFalse(fmt.isCurrencyCodeBeforeValue());
<a name="line940"></a>
<a name="line941"></a>
<a name="line942"></a>  // Using custom patterns instead of standard locale ones
<a name="line943"></a>
<a name="line944"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00A4 #0&#39;);
<a name="line945"></a>  assertTrue(fmt.isCurrencyCodeBeforeValue());
<a name="line946"></a>
<a name="line947"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00A4 0 and #&#39;);
<a name="line948"></a>  assertTrue(fmt.isCurrencyCodeBeforeValue());
<a name="line949"></a>
<a name="line950"></a>  fmt = new goog.i18n.NumberFormat(&#39;#0 \u00A4&#39;);
<a name="line951"></a>  assertFalse(fmt.isCurrencyCodeBeforeValue());
<a name="line952"></a>
<a name="line953"></a>  fmt = new goog.i18n.NumberFormat(&#39;0 and # \u00A4&#39;);
<a name="line954"></a>  assertFalse(fmt.isCurrencyCodeBeforeValue());
<a name="line955"></a>
<a name="line956"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00A4 0&#39;);
<a name="line957"></a>  assertTrue(fmt.isCurrencyCodeBeforeValue());
<a name="line958"></a>
<a name="line959"></a>  fmt = new goog.i18n.NumberFormat(&#39;0 \u00A4&#39;);
<a name="line960"></a>  assertFalse(fmt.isCurrencyCodeBeforeValue());
<a name="line961"></a>
<a name="line962"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00A4 #&#39;);
<a name="line963"></a>  assertTrue(fmt.isCurrencyCodeBeforeValue());
<a name="line964"></a>
<a name="line965"></a>  fmt = new goog.i18n.NumberFormat(&#39;# \u00A4&#39;);
<a name="line966"></a>  assertFalse(fmt.isCurrencyCodeBeforeValue());
<a name="line967"></a>
<a name="line968"></a>
<a name="line969"></a>  // Edge cases, should never happen (like #0 separated by currency symbol,
<a name="line970"></a>  // or missing currency symbol, or missing both # and 0, or missing all)
<a name="line971"></a>  // We still make sure we get reasonable results (as much as possible)
<a name="line972"></a>
<a name="line973"></a>  fmt = new goog.i18n.NumberFormat(&#39;0 \u00A4 #&#39;);
<a name="line974"></a>  assertFalse(fmt.isCurrencyCodeBeforeValue());
<a name="line975"></a>
<a name="line976"></a>  fmt = new goog.i18n.NumberFormat(&#39;# \u00A4 0&#39;);
<a name="line977"></a>  assertFalse(fmt.isCurrencyCodeBeforeValue());
<a name="line978"></a>
<a name="line979"></a>  fmt = new goog.i18n.NumberFormat(&#39;\u00A4&#39;);
<a name="line980"></a>  assertTrue(fmt.isCurrencyCodeBeforeValue());  // currency first, en_US style
<a name="line981"></a>
<a name="line982"></a>  fmt = new goog.i18n.NumberFormat(&#39;0&#39;);
<a name="line983"></a>  assertTrue(fmt.isCurrencyCodeBeforeValue());  // currency first, en_US style
<a name="line984"></a>
<a name="line985"></a>  fmt = new goog.i18n.NumberFormat(&#39;#&#39;);
<a name="line986"></a>  assertTrue(fmt.isCurrencyCodeBeforeValue());  // currency first, en_US style
<a name="line987"></a>
<a name="line988"></a>  fmt = new goog.i18n.NumberFormat(&#39;#0&#39;);
<a name="line989"></a>  assertTrue(fmt.isCurrencyCodeBeforeValue());  // currency first, en_US style
<a name="line990"></a>
<a name="line991"></a>  fmt = new goog.i18n.NumberFormat(&#39;0 and #&#39;);
<a name="line992"></a>  assertTrue(fmt.isCurrencyCodeBeforeValue());  // currency first, en_US style
<a name="line993"></a>
<a name="line994"></a>  fmt = new goog.i18n.NumberFormat(&#39;nothing&#39;);
<a name="line995"></a>  assertTrue(fmt.isCurrencyCodeBeforeValue());  // currency first, en_US style
<a name="line996"></a>}
<a name="line997"></a>
<a name="line998"></a>function testCompactWithBaseFormattingNumber() {
<a name="line999"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line1000"></a>      goog.i18n.NumberFormat.Format.COMPACT_SHORT);
<a name="line1001"></a>
<a name="line1002"></a>  fmt.setBaseFormatting(1000);
<a name="line1003"></a>  assertEquals(&#39;0.8K&#39;, fmt.format(800, 1000));
<a name="line1004"></a>
<a name="line1005"></a>  fmt.setBaseFormatting(null);
<a name="line1006"></a>  assertEquals(&#39;800&#39;, fmt.format(800, 1000));
<a name="line1007"></a>  fmt.setBaseFormatting(1000);
<a name="line1008"></a>  assertEquals(&#39;1,200K&#39;, fmt.format(1200000, 1000));
<a name="line1009"></a>  assertEquals(&#39;0.01K&#39;, fmt.format(10, 1000));
<a name="line1010"></a>  fmt.setSignificantDigits(0);
<a name="line1011"></a>  fmt.setMinimumFractionDigits(2);
<a name="line1012"></a>  assertEquals(&#39;0.00K&#39;, fmt.format(1, 1000));
<a name="line1013"></a>}
<a name="line1014"></a>
<a name="line1015"></a>function testCompactWithBaseFormattingFrench() {
<a name="line1016"></a>  // Switch to French.
<a name="line1017"></a>  stubs.set(goog.i18n, &#39;NumberFormatSymbols&#39;, goog.i18n.NumberFormatSymbols_fr);
<a name="line1018"></a>  stubs.set(goog.i18n, &#39;CompactNumberFormatSymbols&#39;,
<a name="line1019"></a>            goog.i18n.CompactNumberFormatSymbols_fr);
<a name="line1020"></a>
<a name="line1021"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line1022"></a>      goog.i18n.NumberFormat.Format.COMPACT_SHORT);
<a name="line1023"></a>  assertEquals(&#39;123\u00A0M&#39;, fmt.format(123400000));
<a name="line1024"></a>  fmt.setBaseFormatting(1000);
<a name="line1025"></a>  assertEquals(&#39;123\u00A0400\u00A0k&#39;, fmt.format(123400000));
<a name="line1026"></a>
<a name="line1027"></a>}
<a name="line1028"></a>
<a name="line1029"></a>function testGetBaseFormattingNumber() {
<a name="line1030"></a>  var fmt = new goog.i18n.NumberFormat(
<a name="line1031"></a>      goog.i18n.NumberFormat.Format.COMPACT_SHORT);
<a name="line1032"></a>  assertEquals(null, fmt.getBaseFormatting());
<a name="line1033"></a>  fmt.setBaseFormatting(10000);
<a name="line1034"></a>  assertEquals(10000, fmt.getBaseFormatting());
<a name="line1035"></a>}
<a name="line1036"></a>
<a name="line1037"></a>// Moved Polish, Romanian, other currencies to tier 2, check that it works now
<a name="line1038"></a>function testPolish() {
<a name="line1039"></a>  goog.i18n.NumberFormatSymbols = goog.i18n.NumberFormatSymbols_pl;
<a name="line1040"></a>  var fmPl = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.CURRENCY);
<a name="line1041"></a>  goog.i18n.NumberFormatSymbols = goog.i18n.NumberFormatSymbols_ro;
<a name="line1042"></a>  var fmRo = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.CURRENCY);
<a name="line1043"></a>  goog.i18n.NumberFormatSymbols = goog.i18n.NumberFormatSymbols_en;
<a name="line1044"></a>
<a name="line1045"></a>  assertEquals(&#39;100.00\u00A0z\u0142&#39;, fmPl.format(100)); // 100.00 z?
<a name="line1046"></a>  assertEquals(&#39;100.00\u00A0RON&#39;, fmRo.format(100));
<a name="line1047"></a>}
</pre>


</body>
</html>
